Repository navigation
Conversation
The ARG was declared before the first FROM and never redeclared in the final stage, so it was empty there, and the cert directory was never copied into the image. The block was a no-op for every build. Redeclare the ARG, read the directory through a bind mount of the build context, and install .crt and .pem files (update-ca-certificates only picks up .crt).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The custom CA support from #206 (documented in the translated READMEs: drop
.crt/.pemfiles incerts/, ordocker build --build-arg CUSTOM_CERT_DIR=...) never takes effect:ARG CUSTOM_CERT_DIR="certs"is declared before the firstFROMand not redeclared in the final stage, so${CUSTOM_CERT_DIR}is empty there and the wholeifis skipped.[ -d certs ]in/appwould still be false.update-ca-certificatesonly reads*.crt, so.pemfiles would be ignored.This redeclares the ARG in the final stage, reads the directory through a
RUN --mount=type=bindof the build context (nothing extra ends up in the image, and a missing directory is just skipped), and installs.crtand.pemfiles as.crt.Tested with a small harness that takes the top-level ARG plus the cert block from each Dockerfile onto
debian:stable-slimwith a self-signed CA in the context:certs/test-ca.pem--build-arg CUSTOM_CERT_DIR=my-certs,other.crt--build-arg CUSTOM_CERT_DIR=nope